function [Ff_1,ff_1,Fi_1,fi_1,Ff_2,ff_2,Fi_2,fi_2]=solve_wage_offer_dist(Par1,wf_1,wi_1,wf_2,wi_2,n)

alphaf=Par1(17);
betaf=Par1(18);
alphai=Par1(19);
betai=Par1(20);

% solve wage offer distributions
wf_1_n=(wf_1-wf_1(1))/(wf_1(n)-wf_1(1));
Ff_1=betainc(wf_1_n,alphaf,betaf);
ff_1=[eps;Ff_1(2:n)-Ff_1(1:n-1)];

wi_1_n=(wi_1-wi_1(1))/(wi_1(n)-wi_1(1));
Fi_1=betainc(wi_1_n,alphai,betai);
fi_1=[eps;Fi_1(2:n)-Fi_1(1:n-1)];

wf_2_n=(wf_2-wf_2(1))/(wf_2(n)-wf_2(1));
Ff_2=betainc(wf_2_n,alphaf,betaf);
ff_2=[eps;Ff_2(2:n)-Ff_2(1:n-1)];

wi_2_n=(wi_2-wi_2(1))/(wi_2(n)-wi_2(1));
Fi_2=betainc(wi_2_n,alphai,betai);
fi_2=[eps;Fi_2(2:n)-Fi_2(1:n-1)];

Ff_1=1-Ff_1;
Fi_1=1-Fi_1;
Ff_2=1-Ff_2;
Fi_2=1-Fi_2;
end

